import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { list as deviceTypeList } from '../deviceType/deviceType.api';
import { getDeviceModelByType } from '../deviceModel/deviceModel.api';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { buildUUID } from '/@/utils/uuid';

export const columns: BasicColumn[] = [
  {
    title: '设备名称',
    dataIndex: 'name',
    width: 120,
  },
  {
    title: '设备地址',
    dataIndex: 'childSn',
    width: 100,
  },
  {
    title: '数据格式',
    dataIndex: 'dataFormat',
    width: 120,
  },
  {
    title: '备注',
    dataIndex: 'remark',
    width: 80,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    label: '设备名称',
    field: 'name',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    label: '设备编号',
    field: 'childSn',
    component: 'Input',
    colProps: { span: 6 },
  },
];

export const formSchema: FormSchema[] = [
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
  {
    label: '设备名称',
    field: 'name',
    component: 'Input',
    required: true,
  },
  {
    label: '设备地址',
    field: 'childSn',
    component: 'Input',
    required: true,
  },
  {
    label: '数据格式',
    field: 'dataFormat',
    component: 'Select',
    defaultValue: 'ABCD',
    componentProps: {
      options: [
        {label: 'ABCD', value: 'ABCD'},
        {label: 'BADC', value: 'BADC'},
        {label: 'DCBA', value: 'DCBA'},
        {label: 'CDAB', value: 'CDAB'},
      ],
      getPopupContainer: () => document.body,
    },
    required: true,
  },
  {
    label: '备注',
    field: 'remark',
    component: 'Input',
  },
];